package com.example.christina.controller;

import com.example.christina.enity.Goods;
import com.example.christina.service.GoodsService;
import com.example.christina.tools.WeiXin;
import com.example.christina.tools.ZhiFuBao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.christina.repository.AdminRepository;

@RestController
@RequestMapping(value = "pay")
public class PayController {
    @Autowired
    GoodsService goodsService;
    @GetMapping(path = "weiXin")
    public String weiPay(@RequestParam(required = false) String name)
    {
        String res = WeiXin.pay((Goods)goodsService.getGoods(name).get(0));
        return res;
    }

    @GetMapping(path = "zhiFuBao")
    public  String zhiPay(@RequestParam(required = false) String name)
    {
        String res = ZhiFuBao.pay((Goods)goodsService.getGoods(name).get(0));
        return res;
    }

}
